
%\documentclass{article}
% \title{Language syntax}

% \setlength{\oddsidemargin}{-0.2in}
% \setlength{\evensidemargin}{-0.2in}
% \setlength{\textwidth}{7in}
% \setlength{\textheight}{9in}

%\begin{document}
% \maketitle


\section{White Paper}
Modern GPUs are designed to perform extremely fast, highly parallelized matrix processing; but their power is often under-utilized by most common computing tasks. By offloading certain specialized processes to the GPU, one can expect massive performance gains. MatPix is a programming language for matrix arithmetic -- similar to the popular software package, Matlab, but with the performance gains that are realizable by utilizing the GPU. Essentially, the MatPix compiler will translate MatPix source code into C code with embedded OpenGL calls for optimized matrix operations.

\subsection{Goal}
Historically, Matlab has been the reigning champion of matrix arithmetic programming. To be fair, MatPix poses no threat to this title. MatPix's primary contribution to programming languages is purely theoretical. We see great potential in GPU processing and propose this language as a stepping stone to a richer, fully-realized scientific computing language for the GPU. Similar endeavors are already under way; mainly by the graphics card manufacturers themselves. Nvidia recently released a library add-on for Matlab that, provided your computer has a Nvidia GPU, will process certain operations exclusively on the GPU, yielding dramatic performance improvements. Since we are not afforded the time and resources of Nvidia, we propose much more modest goals. Ultimately, we aim to implement basic arithmetic functions | simple unary and binary operations | that can be used to perform essential matrix calculations on the GPU.

\subsection{High-level Description}
Like Matlab, the language of MatPix is designed to be clear and intuitive to anyone familiar with linear algebra and a nominal amount of structured programming. In keeping with the mathematical paradigm, MatPix is not an explicitly typed language. Every variable is implicitly of type ``matrix."  Furthermore, no special declarations are needed. Variables can be created at any point in a program, simply by assigning them a value. Dynamic allocation of matrices at runtime is stable and completely invisible to the user. Familiar and intuitive control flow structures add basic, yet crucial, branching and looping functionality. User-defined functions enable efficiency of code. In short, MatPix is intended to facilitate scientific computing tasks with minimal programming.

\subsection{Main Language Features}
In this section, we discuss some of the main features of MatPix.

\subsubsection{Data Types}
Fundamentally, every named variable is an arbitrarily sized, 2-dimensional matrix. There is no need to explicitly declare a variable's type, as all variables are implicitly of type ``matrix." All scalar values have 32-bit floating-point precision, thus eliminating most conversion and precision concerns. (Note that all indexing expressions are converted to integer values before indexing.)

\subsubsection{Matrix Access}
Matrices can be accessed in two ways:
\begin{itemize}
	\item They can be accessed as a whole, meaning the entire contents will be retrieved or modified.
	\item They can be sliced along rows, columns, individual elements or contiguous blocks, thereby affecting only specific regions.
\end{itemize}

\subsubsection{Matrix Constants}
MatPix offers a simple, intuitive syntax for declaring matrix constants.

\subsubsection{Operators}
MatPix supports basic unary and binary operators that can be applied to both variables and constants. These operators include: addition; subtraction, multiplication, division, modulo, dot-product, increment, decrement, transpose, logical negation, AND, OR and relational operators. All operators (except for dot-product and transpose) perform element-wise computations on matrices.

\subsubsection{Control Flow}
Program control flow is accomplished via familiar syntactical and structural paradigms. MatPix supports if()/else() structures for branching and for() and while() loops for iteration.

\subsubsection{User-defined Functions}
MatPix supports user-defined functions to promote reusable code. Furthermore, MatPix supports recursion, thus enabling efficient, streamlined function implementation.

\subsubsection{Output}
MatPix offers a built-in print function, for simple, yet crucial, access to standard output.

\subsubsection{Invisible Memory Management}
Memory management is safe, efficient and completely invisible to the user. Memory leaks and null pointer checks are a non-issue in MatPix.


%\end{document}

